<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //异步深层嵌套 回调地狱  
        function * fun(){
            const a = yield 'xxx';
            console.log("a",a);  //2
            const b = yield 'yyy';
            console.log("b",b);  //3
        }

        const funInter = fun();

        console.log(fun())  //遍历器对象
        console.log(funInter.next(1));//{value: "xxx", done: false}
        console.log(funInter.next(2));//{value: "yyy", done: false}
        console.log(funInter.next(3));//{value: "yyy", done: true}

        //next 传递的值会给到上一个yield前面的变量
    </script>
</body>
</html>